package net.xmmpp.uc.im.bootstrap.web.metrics;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.MeterBinder;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class DemoMetrics implements MeterBinder {

    public Counter counter;
    public Map<String, Double> map;

    public DemoMetrics(){
        map = new HashMap<>();
        map.put("x", 1D);
        map.put("y", 2D);
        map.put("z", 3D);
    }

    @Override
    public void bindTo(MeterRegistry meterRegistry) {
        counter = Counter.builder("prometheus.demo.counter")
                .tags(new String[]{"name1", "counter1", "name2", "counter2"})
//                .tag("name", "counter1")
                .description("demo counter1")
                .register(meterRegistry);
    }
}
